/*
 * @Author: ChunLai
 * @Date: 2022-03-30 14:31:14
 * @LastEditTime: 2025-08-13 15:59:06
 * @Description: 是否可以编辑 + 配置全局公共常用保单参数
 * @FilePath: \02.bldinsure\src\mixins\edit.js
 */
import { mapGetters } from "vuex";
import { openInWebview } from "@/utils";
export const editMixin = {
  data() {
    return {
      origin: "",
      imgUrlPath: "https://wxou.mschn.cn/app_h5/insurepics",
    };
  },
  computed: {
    ...mapGetters({
      workNum: "insert/workNum",
      orderNum: "insert/orderNum",
      compEngName: "insert/compEngName",
      disabledEdit: "insert/forbidAlter",
      underwriteFlag: "insert/underwriteFlag",
      mainRiskCode: "insert/mainRiskCode",
      proBldIdNo: "insert/proBldIdNo",
      proUniqueId: "insert/proUniqueId",
      bldUserId: "insert/bldUserId",
      typeFlag: "insert/typeFlag",
      isNetInsure: "page/isNetInsure",
    }),
    apiComParams() {
      let res = {
        comCode: "minsheng",
        mainRiskCode: this.mainRiskCode,
        workNum: this.workNum,
        orderNum: this.orderNum,
      };
      if (this.typeFlag) {
        res.typeFlag = this.typeFlag;
      }
      return res;
    },
    rrwebType() {
      let res = "20";
      if (this.$getDataFromUrl("rrweb")) {
        res = this.$getDataFromUrl("rrweb");
      }
      return res;
    },
  },
  created() {
    this.origin = openInWebview();
  },
  methods: {
    forbidChange() {
      this.$baseAlert("该保单已核保,不可修改信息", () => {
        if (["3", "5", "-1"].includes(this.underwriteFlag)) {
          this.$router.push("/billres");
        } else {
          this.$router.push("/billsure");
        }
      });
    },
  },
};
